/**
 * @fileoverview 为Count服务的reducer
 */

// 初始化state
const initState = 0

const countReducer = (preState = initState, action) => {
  console.log(preState, action)
  const { data, type } = action
  switch (type) {
    case 'increment':
      return preState + data
    case 'decrement':
      return preState - data

    default:
      return preState
  }
}

export default countReducer
